package org.karelun.whiteboard.ui.local.handler;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.karelun.whiteboard.ui.local.editor.LocalEditorInput;

/**
 * @Author: KarelunHuang
 * @Date: Jan 23, 2013
 **/
public class NewLocalEditorHandler extends AbstractHandler {

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		LocalEditorInput editorInput = new LocalEditorInput();
		IWorkbenchPage page =PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
		try {
			page.openEditor(editorInput, "org.karelun.whiteboard.ui.local.editor");
		} catch (PartInitException e) {
			e.printStackTrace();
		}
		return null;
	}

}
